@echo off
setlocal
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat">nul 2>nul
call "C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat">nul 2>nul

cd /d %~dp0
rd /S /Q bin>nul 2>nul

set TEMP_BUILD_LOG=BuildLog.txt
Echo Building Type Finder
msbuild /p:configuration=Release /p:platform=x86 TypeFinder.sln >%TEMP_BUILD_LOG%
if errorlevel 1 (
	echo Failed to build TypeFinder in 32bit Release Mode.
	type %TEMP_BUILD_LOG%
	if not defined NOPAUSE pause
	exit /b 1
)
pushd .
cd bin
ren TypeFinder.exe TypeFinderX86.exe
popd
if errorlevel 1 (
	echo Failed to create 32 bit exe
	if not defined NOPAUSE pause
	exit /b 1
)
echo 32bit Build completed

msbuild /p:configuration=Release /p:platform=x64 TypeFinder.sln >%TEMP_BUILD_LOG%
if errorlevel 1 (
	echo Failed to create 64 bit exe
	type %TEMP_BUILD_LOG%
	if not defined NOPAUSE pause
	exit /b 1
)
pushd .
cd bin
ren TypeFinder.exe TypeFinderX64.exe
popd
echo 64bit Build completed
Echo Cleaning Up Temporary files

del .\bin\TypeFinder.pdb>nul 2>nul
del .\bin\TypeFinder.vshost.exe>nul 2>nul
del .\bin\TypeFinder.exe.config>nul 2>nul

del %TEMP_BUILD_LOG%>nul 2>nul

rd /S /Q .\TypeFinder\obj>nul 2>nul
rd /S /Q .\TypeFinder\bin>nul 2>nul
Echo Completed Building Type Finder
if not defined NOPAUSE pause


